import request from "@/utils/request";
import {DownloadTaskQuery} from "./model";

class DownloadTaskAPI {

    static listPage(queryParams?: DownloadTaskQuery) {
        return request<any, ApiResult>({
            url: "/api/downloadTask/query",
            method: "post",
            data: queryParams,
        });
    }


    static cancelTask(taskId: string) {
        return request<any, ApiResult>({
            url: "/api/downloadTask/cancelTask",
            method: "post",
            data: {taskId: taskId},
        });
    }

    static download(taskId: string) {
        return request({
            url: "/api/downloadTask/download",
            method: "get",
            params: {taskId: taskId},
            responseType: 'blob'
        });
    }
}

export default DownloadTaskAPI;
